import request from "./config";

//获取网页信息
export function getPageInfo() {
  return request({
    url: "/common/getPageInfo",
    method: "get",
  });
}
//获取文章信息
export function getArticle(params) {
  return request({
    url: "/common/getArticle",
    method: "get",
    params,
  });
}
// 通用登录
export function login(data) {
  return request({
    url: "/common/login",
    headers: {
      isToken: true,
    },
    method: "post",
    data: data,
  });
}
// 注册
export function reguser(data) {
  return request({
    url: "/common/reguser",
    headers: {
      isToken: true,
    },
    method: "post",
    data: data,
  });
}
// 获取当前用户信息
export function userinfo() {
  return request({
    url: "/user/userinfo",
    method: "get",
  });
}
// 修改用户信息
export function setUserInfo(data) {
  return request({
    url: "/user/setUserInfo",
    method: "put",
    data: data,
  });
}
// 获取我的生活
export function getMyLife() {
  return request({
    url: "/common/getMyLife",
    method: "get",
  });
}
// 获取导航
export function getNav(params) {
  return request({
    url: "/common/getNav",
    method: "get",
    params,
  });
}
// 根据文章id获取评论
export function getCommontById(params) {
  return request({
    url: "/common/getCommontById",
    method: "get",
    params,
  });
}
// 发布评论
export function addComment(data) {
  return request({
    url: "/user/addComment",
    method: "post",
    data: data,
  });
}
// 获取分类
export function getClass(params) {
  return request({
    url: "/common/getClass",
    method: "get",
    params,
  });
}
// 根据文章id获取文章信息
export function getArticleInfo(params) {
  return request({
    url: "/common/getArticleInfo",
    method: "get",
    params,
  });
}
// 浏览量+1
export function addPageview(data) {
  return request({
    url: "/common/addPageview",
    method: "put",
    data: data,
  });
}
